package cn.yangliu.webflux.comm;

import lombok.Data;

/**
 * @author 杨柳
 * @date 2019-05-16
 */
@Data
public class JsonResult<T> {

    private int code = 200;

    private String msg;

    private T data;


    private JsonResult(T data) {
        this.data = data;
    }

    private JsonResult(int code, String msg) {
        this.code = code;
        this.msg = msg;
    }

    public static <T> JsonResult<T> getInstance(T data){
        return new JsonResult<>(data);
    }

    public static <T> JsonResult<T> getInstance(){
        return new JsonResult<>(null);
    }

    public static <T> JsonResult<T> getInstance(int code, String msg){
        return new JsonResult<>(code, msg);
    }
}
